﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Data.Models;
using Presentation.Models;

namespace Tests
{
    [TestFixture]
    class FileTests
    {
        DataModels _dataModels;
        PresentationModels _presentationModels;
        Data.Sources.File _file;

        [SetUp]
        public void Setup()
        {
            _dataModels = (new Data.Sources.Test()).GetData();
            _presentationModels = new PresentationModels(_dataModels);
            _file = new Data.Sources.File("Test.ant");
        }

        [Test]
        public void SaveOpenTest()
        {
            _file.SaveData(_dataModels);
            DataModels openedData = _file.GetData();

            //anecdotes
            openedData.Anecdotes[0].Date = _dataModels.Anecdotes[0].Date;
            openedData.Anecdotes[0].DomainID = _dataModels.Anecdotes[0].DomainID;
            openedData.Anecdotes[0].StudentID = _dataModels.Anecdotes[0].StudentID;
            openedData.Anecdotes[0].Note = _dataModels.Anecdotes[0].Note;
            openedData.Anecdotes[0].ID = _dataModels.Anecdotes[0].ID;

            openedData.Anecdotes[1].Date = _dataModels.Anecdotes[1].Date;
            openedData.Anecdotes[1].DomainID = _dataModels.Anecdotes[1].DomainID;
            openedData.Anecdotes[1].StudentID = _dataModels.Anecdotes[1].StudentID;
            openedData.Anecdotes[1].Note = _dataModels.Anecdotes[1].Note;
            openedData.Anecdotes[1].ID = _dataModels.Anecdotes[1].ID;
            
            //domains
            openedData.Domains[0].ID = _dataModels.Domains[0].ID;
            openedData.Domains[0].Name = _dataModels.Domains[0].Name;

            openedData.Domains[1].ID = _dataModels.Domains[1].ID;
            openedData.Domains[1].Name = _dataModels.Domains[1].Name;

            //students
            openedData.Students[0].ID = _dataModels.Students[0].ID;
            openedData.Students[0].Name = _dataModels.Students[0].Name;

            openedData.Students[1].ID = _dataModels.Students[1].ID;
            openedData.Students[1].Name = _dataModels.Students[1].Name;


        }
    }
}
